//
//  Obstacle.m
//  TheifRunning
//
//  Created by Lion on 6/16/14.
//  Copyright (c) 2014 Apportable. All rights reserved.
//

#import "Obstacle.h"

@implementation Obstacle{
    CCNode *_obstacle;
}

#define ARC4RANDOM_MAX      0x100000000
// visibility on a 3,5-inch iPhone ends a 88 points and we want some meat
static const CGFloat minimumXPosition = 0;
// visibility ends at 480 and we want some meat
static const CGFloat maximumXPosition = 500;

- (void) didLoadFromCCB{
    _obstacle.physicsBody.collisionType = @"obstacle";
}

-(void) setRandomPosition{
    CGFloat random = ((double)arc4random() / ARC4RANDOM_MAX);
    CGFloat rangeX = maximumXPosition - minimumXPosition;
    _obstacle.position = ccp(_obstacle.position.x + (random * rangeX), _obstacle.position.y);

}
@end
